package com.vegetable.modules.mapper.inbound;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vegetable.modules.entity.finance.po.ADCanPayPO;
import com.vegetable.modules.entity.inbound.AgentDelivery;
import com.vegetable.modules.entity.inbound.po.AgentDeliverySequencePO;
import com.vegetable.modules.vo.AgentDeliveryDetailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 入库-代办交货 Mapper 接口
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-07
 */
@Mapper
public interface AgentDeliveryMapper extends BaseMapper<AgentDelivery> {

    /**
     * 入库代办交货总表查询
     * @param po
     * @return
     */
    IPage<AgentDeliveryDetailVO> sequence(IPage page, AgentDeliverySequencePO po);

    Map<String, Object> sequenceSta(AgentDeliverySequencePO po);

    /**
     * 生成流水单号
     * @return
     */
    String getNextCode();

    /**
     *
     * @return List<AgentDeliveryDetailVO>
     * @author wrj
     * @since 2024/7/1 下午9:00
     */
    List<AgentDeliveryDetailVO> todayAgentDelivery(Long agentId, String orderTime);

    List<AgentDeliveryDetailVO> canPaymentList(ADCanPayPO po);
    
    /**
     * 获取指定日期商品的最高价格和最低价格
     * @param commodityId 商品ID
     * @param orderTime 订单时间
     * @return 包含最高价格和最低价格的Map
     */
    Map<String, Object> getPriceRangeByOrderTime(@Param("commodityId") Long commodityId, @Param("orderTime") Date orderTime);
    
    /**
     * 入库代办交货列表查询统计
     * @param wrapper 查询条件
     * @return 统计结果
     */
    Map<String, Object> queryPageStatistics(@Param("ew") Wrapper<AgentDelivery> wrapper);
}